public class ZhaiZhiJie8
{
    public static void main(String[] args)
    {
        // 定义对象数组
        Book[] books = new Book[5];
        books[0] = new Book("Book1", 20.5);
        books[1] = new Book("Book2", 15.7);
        books[2] = new Book("Book3", 12.3);
        books[3] = new Book("Book4", 18.9);
        books[4] = new Book("Book5", 25.0);

        // 输出总册数
        System.out.println("Total number of books: " + Book.getTotalBooks());
    }
}

class Book
{
    private String title;
    private double price;
    private static int bookCount = 0; // 静态数据成员册数
    private static int totalBooks = 0; // 记录图书的总册数
    private int id;

    public Book(String title, double price) {
        this.title = title;
        this.price = price;
        this.id = ++totalBooks; // 自动编号
        bookCount++; // 增加册数
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public int getId() {
        return id;
    }

    public static int getTotalBooks() {
        return totalBooks;
    }

    public static int getBookCount() {
        return bookCount;
    }
}